import MySQLdb
# make sure you install two things before running this script:
# mysql server 5.5 => http://dev.mysql.com/tech-resources/articles/mysql-installer-for-windows.html
# mysql connector for python => http://www.codegood.com/archives/129


# sample db in mysql installation
# the db sakila comes with the installation
lookup = ""
while True:
    lookup = raw_input("What names are you looking for? ")
    if lookup != "":
        break

    
conn = MySQLdb.connect(host="localhost", user="root", passwd="123456", db="sakila")
cursor = conn.cursor()
stmt = "SELECT * FROM sakila.actor where first_name = '%s'"
parsedStmt = stmt % (lookup)
print parsedStmt
cursor.execute(parsedStmt)
rows = cursor.fetchall()
for row in rows:
    for col in row:
        print col,
    print "\n"

cursor.close()
conn.close()
